package com.lancer.dynamic.thread.pool.config;

import com.lancer.dynamic.thread.pool.lancerenum.RejectEnum;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.concurrent.TimeUnit;

/**
 * 线程池 配置类
 *
 * @author admin
 * @date 2025/06/12
 */
@ConfigurationProperties(prefix = "lancer.dynamic.thread-pool")
@Data
public class ThreadPoolConfig {
    // 是否开启
    private Boolean enable = true;
    // 线程池的唯一标识
    private String poolName = "lancer-dynamic-thread-pool";
    // 核心线程
    private int corePoolSize = 5;
    // 最大线程
    private int maxPoolSize = 10;
    // 空闲线程的存活时间
    private int keepAliveTime = 10;
    // 存活时间单位
    private TimeUnit unit = TimeUnit.SECONDS;
    // 任务队列长度
    private int queueCapacity = 1000;
    // 拒绝策略
    private RejectEnum rejectEnum = RejectEnum.CALLER_RUNS;
}
